﻿using System.ComponentModel;
using System.Configuration.Install;
using System.ServiceProcess;

namespace Lootom.Nms.WindowsService
{
    [RunInstaller(true)]
    public class ProjectInstaller : Installer
    {
        private ServiceInstaller _bookService;
        private ServiceProcessInstaller _serviceProcessInstaller1;

        /// <summary>
        /// 必需的设计器变量。
        /// </summary>
        private IContainer components;

        public ProjectInstaller()
        {
            InitializeComponent();
        }

        /// <summary> 
        /// 清理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源，为 true；否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region 组件设计器生成的代码

        /// <summary>
        /// 设计器支持所需的方法 - 不要
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            _serviceProcessInstaller1 = new ServiceProcessInstaller();
            _bookService = new ServiceInstaller();
            // 
            // _serviceProcessInstaller1
            // 
            _serviceProcessInstaller1.Account = ServiceAccount.LocalSystem;
            _serviceProcessInstaller1.Password = null;
            _serviceProcessInstaller1.Username = null;
            // 
            // bookService
            // 
            _bookService.Description = "自定义WCF宿主服务";
            _bookService.ServiceName = "Book Service 服务";
            _bookService.StartType = ServiceStartMode.Automatic;
            // 
            // ProjectInstaller
            // 
            Installers.AddRange(new Installer[]
                                    {
                                        _bookService,
                                        _serviceProcessInstaller1
                                    });
        }

        #endregion
    }
}